package zuoye;

import java.util.Scanner;

public class one {
    public static void main(String[] args) {
        System.out.println("分数为"+dafen(5));
    }

    public static int dafen(int n){
        Scanner r=new Scanner(System.in);
        int cont=0;
        int [] arr=new int[n];
        for (int i = 0; i < arr.length; i++) {
            System.out.println("请输入第"+(i+1)+"个评委的分数");
            int a= r.nextInt();
            arr[i]=a;
        }
        int max= arr[0];
        for (int i = 0; i < arr.length; i++) {

            max=arr[i]>max?arr[i]:max;

        }
        int min= arr[0];
        for (int i = 0; i < arr.length; i++) {

            min=arr[i]>min?min:arr[i];
        }
        for (int i = 0; i < arr.length; i++) {
            cont += arr[i];

        }
        return (cont-max-min)/(n-2);
    }
}